﻿using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
using Microsoft.Web.Mvc;

namespace SportMeetingPlanner.ViewModels
{
    public class ChangePasswordModel
    {
        [Required]
        [DataType(DataType.Password)]
        [Display(Name = "Current password")]
        public string PasswordToken { get; set; }

        [Required]
        [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
        [DataType(DataType.Password)]
        [Display(Name = "New password")]
        public string NewPassword { get; set; }

        [DataType(DataType.Password)]
        [Display(Name = "Confirm new password")]
        [Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
        public string ConfirmPassword { get; set; }
    }

    public class ForgotPasswordModel
    {
        [Required(ErrorMessage = "User name is required")]
        public string UserName { get; set; }
    }

    public class LogOnModel
    {
        [Required]
        public string UserName { get; set; }

        [Required]
        [DataType(DataType.Password)]
        public string Password { get; set; }

        [Display(Name = "Remember me?")]
        public bool RememberMe { get; set; }
    }

    public class RegisterModel
    {
        [Required(ErrorMessage = "UserName is required")]
        [RegularExpression("^[a-zA-Z0-9]+$", ErrorMessage = "User name should contain only letters and numbers")]
        public string UserName { get; set; }
        [RegularExpression("^[a-zA-Z0-9]+$", ErrorMessage = "First name should contain only letters and numbers")]
        public string FirstName { get; set; }
        [RegularExpression("^[a-zA-Z0-9]+$", ErrorMessage = "Last name should contain only letters and numbers")]
        public string LastName { get; set; }
        [Required(ErrorMessage = "E-Mail is required")]
        [EmailAddress]
        public string Email { get; set; }
        [Required(ErrorMessage = "Telephone number is required")]
        [RegularExpression("[0-9]+", ErrorMessage = "Telephone number should contain only numbers")]
        public string TelephoneNumber { get; set; }
        [Required(ErrorMessage = "Password is required")]
        public string Password { get; set; }
        [Required(ErrorMessage = "Please re-type password")]
        [Compare("Password", ErrorMessage = "Passwords do not match")]
        public string RepeatPassword { get; set; }
    }

    public class ChangeUserInformationModel
    {
        bool isAdmin = false;
        [Required(ErrorMessage = "UserName is required")]

        [RegularExpression("^[a-zA-Z0-9]+$", ErrorMessage = "User name should contain only letters and numbers")]
        public string UserName { get; set; }
        [RegularExpression("^[a-zA-Z0-9]+$", ErrorMessage = "First name should contain only letters and numbers")]
        public string FirstName { get; set; }
        [RegularExpression("^[a-zA-Z0-9]+$", ErrorMessage = "Last name should contain only letters and numbers")]
        public string LastName { get; set; }
        [Required(ErrorMessage = "E-Mail is required")]
        [EmailAddress]
        public string Email { get; set; }
        [Required(ErrorMessage = "Telephone number is required")]
        [RegularExpression("[0-9]+", ErrorMessage = "Telephone number should contain only numbers")]
        public string TelephoneNumber { get; set; }
        public bool IsAdmin
        {
            get { return isAdmin; }
            set { isAdmin = value; }
        }
    }
}